package binarization;

import draw.ExploringMedics;

public class SimpleBinary {

    int imageDescr[][];
    int width = 0;
    int height = 0;

    public SimpleBinary() {
    }

    public void setImageDescr(int[][] imageDescr, int threshold) {
        width = imageDescr.length;
        height = imageDescr[0].length;
        this.imageDescr = new int[width][height];
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                this.imageDescr[i][j] = imageDescr[i][j];
            }
        }
        doBinary(threshold);
    }

    public int[][] getImageDescr() {
        return imageDescr;
    }

    void doBinary(int threshold) {
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                imageDescr[i][j] = imageDescr[i][j] > threshold ? ExploringMedics.WHITE : ExploringMedics.BLACK;
            }
        }
    }
}
